package foo.websystem.vo;

import java.util.Collection;
import java.util.HashSet;

public class Menu implements Comparable<Menu> {
	private int order;
	private String label;
	private String url;

	public int getOrder() {
		return order;
	}

	public void setOrder(int order) {
		this.order = order;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Collection<Menu> getSubMenus() {
		return subMenus;
	}

	private Collection<Menu> subMenus;

	public Menu() {
		subMenus = new HashSet<Menu>();
	}

	public void addMenu(Menu menu) {
		subMenus.add(menu);
	}

	public int compareTo(Menu o) {
		if (o == null) {
			return 1;
		} else if (order == o.order) {
			return 0;
		} else if (order > o.order) {
			return 1;
		} else {
			return -1;
		}
	}
}
